import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import ConfigElementType 1.0
import "qrc:/qmlComponents/ConfigManager"
import "qrc:/qmlComponents/AxisModulePos"
import "qrc:/qmlComponents/VisionViewer"
import "qrc:/qmlComponents/CustomizedUIElement/RowColumnSelectorView"

Item {
    ColumnLayout{
        RowLayout{
            SAxisModulePos{
                moduleName: "LTLoaderTrackX"
                posName: "LeftLensPrPos"
            }
            ConfigRow{
                configModel: bhConfig
                configName: "ltCameraPrPosXShift"
                Component.onCompleted: {
                    autoInit()
                }
            }
        }
        RowLayout{
            VisionLocationViewer{
                visionLocationName: "LTLensLocation"
                performPrResultVisible: false
                calibrateBtnVisible: false
            }
            VisionLocationViewer{
                visionLocationName: "LTVacancyLocation"
                performPrResultVisible: false
                calibrateBtnVisible: false
            }
        }
        ColumnLayout{
            RowColumnSelector{
                rowColInfo: ltlRowColInfo
            }

            RowLayout{
                spacing: 15

                Button{
                    text: qsTr("PickLens")
                    onClicked: {
                        tem.runSingleCmd(bonderHead, "manuallyPickLens",
                                         [ltlRowColInfo.unitRow, ltlRowColInfo.unitColumn, ltlRowColInfo.row, ltlRowColInfo.column])
                    }
                }
                Button{
                    text: qsTr("MoveToPrPos")
                    onClicked: {
                        tem.runSingleCmd(lensTrayLoader, "moveToPrPos",
                                         [ltlRowColInfo.unitRow, ltlRowColInfo.unitColumn, ltlRowColInfo.row, ltlRowColInfo.column])
                    }
                }
                Button{
                    text: qsTr("MoveToPerformLensPr")
                    onClicked: {
                        tem.runSingleCmd(lensTrayLoader, "moveToPerformLensPr",
                                         [ltlRowColInfo.unitRow, ltlRowColInfo.unitColumn, ltlRowColInfo.row, ltlRowColInfo.column])
                    }
                }
                Button{
                    text: qsTr("MoveToPerformVacancyPr")
                    onClicked: {
                        tem.runSingleCmd(lensTrayLoader, "moveToPerformVacancyPr",
                                         [ltlRowColInfo.unitRow, ltlRowColInfo.unitColumn, ltlRowColInfo.row, ltlRowColInfo.column])
                    }
                }
            }
        }
    }
}
